'''
历史记录查询接口
'''
import allure
from parameterized import parameterized
import requests
import conftest
from common.logger import Log
from utils.get0701_getRecordPage_data import build_data


class Test_getRecord():

    def setup_method(self):
        # 定义登录接口URL地址
        self.getRecordPage_url = "http://192.168.3.182:9990/airservice-device/record/getRecordPage"
        #实例化日志模块
        self.log = Log("历史记录查询接口").get_logger()


    @parameterized.expand(build_data)
    @allure.step(title="历史记录查询接口")
    def test_getRecordPage_case(self,desc,getRecordPage_data,message,success):
        response = requests.post(url=self.getRecordPage_url, json=getRecordPage_data, headers=conftest.headers_data)

        #添加断言
        assert response.json().get("message") == message
        assert  response.json().get("success") == success

        #打印日志
        self.log.info("{}:{}".format(str(desc[0]),response.json()))


